#region "AspContextVariables"

/*
 * ####     Developer Name : Wang Yucai
 * 
 * ####     Development Tool : Microsoft VisualStudio 2010 Ultimate Edition
 * 
 * ####     Create Time : 2014-07-14 15:23:35
 * 
 * ####     Namespace : Masterduner.SourceStudio.Practices.DevelopmentLibrary.Web.Runtime
 * 
 * ####     Type Name : AspContextVariables
 * 
 * ####     Full Name : Masterduner.SourceStudio.Practices.DevelopmentLibrary.Web.Runtime.AspContextVariables
 * 
 * ####     Machine Name : GLCHQWYCWINW7
 * 
 * ####     UserName : GUOCOLAND/wangyucai
 * 
 * ####     CLR Version : 4.0.30319.18444
 * 
 * ####     Target Framework Version : 4.0
 */

#endregion

using System;
using System.Web.Hosting;
using Masterduner.SourceStudio.Practices.DevelopmentLibrary.Runtime;

namespace Masterduner.SourceStudio.Practices.DevelopmentLibrary.Web.Runtime
{
    /// <summary>
    /// <para>Masterduner.SourceStudio.Practices.DevelopmentLibrary.Web.Runtime.AspContextVariables</para>
    /// <para>
    /// 提供了访问ASP.NET应用上下文变量的方法。
    /// </para>
    /// </summary>
    /// <remarks>
    /// <para>Target Framework Version : 4.0</para>
    /// </remarks>
    public class AspContextVariables : ContextVariables
    {
        private string _siteName;
        private string _applicationVirtualPath;
        static private AspContextVariables _context;

        #region SiteName
        /// <summary>
        /// 获取站点名称。
        /// </summary>
        public virtual string SiteName
        {
            get { return _siteName; }
            protected set { _siteName = value; }
        }
        #endregion

        #region ApplicationPhysicalDirectory
        /// <summary>
        /// 获取ASP.NET应用的物理目录路径。
        /// </summary>
        public virtual string ApplicationPhysicalDirectory
        {
            get { return base.CurrentRunningDirectory; }
            protected set { base.CurrentRunningDirectory = value; }
        }
        #endregion

        #region ApplicationVirtualPath
        /// <summary>
        /// 获取ASP.NET应用的虚拟路径。
        /// </summary>
        public virtual string ApplicationVirtualPath
        {
            get { return _applicationVirtualPath; }
            protected set { _applicationVirtualPath = value; }
        }
        #endregion

        #region Context
        /// <summary>
        /// 获取当前ASP.NET应用的运行变量。
        /// </summary>
        static public new AspContextVariables Context
        {
            get
            {
                if (_context.IsNull()) _context = new AspContextVariables();
                return _context;
            }
        }
        #endregion

        #region Constructor

        /// <summary>
        /// <para>构造函数：</para>
        /// <para>初始化一个<see cref="AspContextVariables" />对象实例。</para>
        /// </summary>
        protected AspContextVariables()
            : base()
        {
            this.SiteName = HostingEnvironment.SiteName;
            this.ApplicationPhysicalDirectory = HostingEnvironment.ApplicationPhysicalPath;
            this.ApplicationVirtualPath = HostingEnvironment.ApplicationVirtualPath;
        }

        #endregion
    }
}

#region README

/*
 * ####     ©2014 Wang Yucai
 * 
 * ####     Contact me
 *                  
 *                  E-mail : Masterduner@Yeah.net
 *                  Mobile : 13621384677
 *                  QQ : 180261899
 */

#endregion